package _nio._socket._bio;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * @Author: huangya
 * @Date: 2021/07/03
 * @Description:
 */
public class SocketClientDemo {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 8080);
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("hello".getBytes());
        outputStream.flush();
//        socket.close();

//        System.out.println("-------------------------");
        try {
            Thread.sleep(40000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        socket.close();

//        socket.getInputStream().read();

//        PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
//        out.println("query time order");
    }
}
